package com.doit.学;

import java.io.*;

public class test02 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {

        method1();
        method2();
    }
    public static void method1() throws IOException {//序列化
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("D:\\IdeaProjects\\doit_26\\day21\\src\\com\\doit\\学\\学.txt"));
        oos.writeObject("ef");
        oos.close();
    }
    public static void method2() throws IOException, ClassNotFoundException {//反序列化
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("D:\\IdeaProjects\\doit_26\\day21\\src\\com\\doit\\学\\学.txt"));
        Object o = ois.readObject();
        System.out.println(o);
        ois.close();
    }
}
